package com.sdry.service.impl.zc;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sdry.mapper.zc.AbnormalDisposalMapper;
import com.sdry.model.zc.AbnormalDisposal;
import com.sdry.service.zc.AbnormalDisposalService;

/**
 * @ClassName: AbnormalDisposalServiceImpl 
 * @Description:生产异常处置单Service实现
 * @Author zc
 * @Date 2018年11月2日 下午4:10:21 
 * @version 1.0
 */
@Service
public class AbnormalDisposalServiceImpl implements AbnormalDisposalService {

	@Resource
	private AbnormalDisposalMapper abnormalDisposalMapper;
	
	/**
	 * 查询总数
	 * @param abnormalDisposal
	 * @return
	 */
	public Integer countAbnormalDisposal(AbnormalDisposal abnormalDisposal) {
		// TODO Auto-generated method stub
		return abnormalDisposalMapper.countAbnormalDisposal(abnormalDisposal);
	}

	/**
	 * 分页查询
	 * @param map
	 * @return
	 */
	public List<AbnormalDisposal> listPageAbnormalDisposal(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return abnormalDisposalMapper.listPageAbnormalDisposal(map);
	}

	/**
	 * 新增生产异常处置单
	 * @param abnormalDisposal
	 * @return
	 */
	public Integer insertAbnormalDisposal(AbnormalDisposal abnormalDisposal) {
		// TODO Auto-generated method stub
		abnormalDisposal.setReserve1("-2");
		return abnormalDisposalMapper.insertAbnormalDisposal(abnormalDisposal);
	}

	/**
	 * 基地经理签字
	 * @param abnormalDisposal
	 * @return
	 */
	public Integer updateAbnormalDisposal(AbnormalDisposal abnormalDisposal) {
		// TODO Auto-generated method stub
		if ("0".equals(abnormalDisposal.getReserve5())) {
			abnormalDisposal.setReserve1("6");
		} else {
			abnormalDisposal.setReserve1("-1");
		}
		return abnormalDisposalMapper.updateAbnormalDisposal(abnormalDisposal);
	}
	/**
	 * 发起
	 */
	@Override
	public int approvalAbnormalDisposal(AbnormalDisposal abnormalDisposal) {
		return abnormalDisposalMapper.approvalAbnormalDisposal(abnormalDisposal);
	}

	/**
	 * 修改
	 * @param abnormalDisposal
	 * @return
	 */
	@Override
	public int editAbnormalDisposal(AbnormalDisposal abnormalDisposal) {
		return abnormalDisposalMapper.editAbnormalDisposal(abnormalDisposal);
	}

	/**
	 * 删除
	 */
	@Override
	public int deleteAbnormalDisposal(AbnormalDisposal abnormalDisposal) {
		return abnormalDisposalMapper.deleteAbnormalDisposal(abnormalDisposal);
	}

}
